package sockettest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ServerThread extends Thread{
    private Socket socket;
    public ServerThread(Socket socket){
        this.socket = socket;
    }
    BufferedReader br =null;
    @Override
    public void run(){
        String str =null;
        try {
            br = new BufferedReader(new InputStreamReader( socket.getInputStream()));
            while (!(str=br.readLine()).equals("exit")){
                System.out.println("客户端说"+str);
            }
            br.close();
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
